package test.socket.simplesocket;

import java.io.IOException;
import java.net.Socket;

public class IOClient2 {

    public static  Socket clientSocket = null;

    static {
        try {
            clientSocket = new Socket("127.0.0.1",8888);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args){

        new Thread(()->{
            while (true) {
                try {
                    clientSocket.getOutputStream().write("22222222222".getBytes());
                    clientSocket.getOutputStream().flush();
                    Thread.sleep(1000);
                } catch (IOException | InterruptedException e) {
                    e.printStackTrace();
                }

            }
        }).start();
    }


}
